package it.bifulco.luigi.motiondetection.prototype;

import java.awt.image.BufferedImage;

public class MotionDetectionEntry implements Comparable<MotionDetectionEntry> {

	private BufferedImage image;

	private Long timestamp;

	public MotionDetectionEntry() {

	}

	public MotionDetectionEntry(Long timestamp, BufferedImage img) {
		this.image = img;
		this.timestamp = timestamp;
	}

	public BufferedImage getImage() {
		return image;
	}

	public void setImage(BufferedImage image) {
		this.image = image;
	}

	public Long getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Long timestamp) {
		this.timestamp = timestamp;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (timestamp ^ (timestamp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		MotionDetectionEntry other = (MotionDetectionEntry) obj;
		if (timestamp != other.timestamp)
			return false;
		return true;
	}

	@Override
	public int compareTo(MotionDetectionEntry o) {
		return o.getTimestamp().compareTo(this.timestamp);
	}

	public static MotionDetectionEntry copy(MotionDetectionEntry _this) {
		return new MotionDetectionEntry(_this.timestamp, _this.image);
	}
}
